﻿namespace System.ServiceModel.DomainServices.Client.ApplicationServices
{
    using System;
    using System.Security.Principal;
    using System.ServiceModel.DomainServices.Client;

    public sealed class LoginResult : AuthenticationResult
    {
        private readonly bool _loginSuccess;

        public LoginResult(IPrincipal user, bool loginSuccess) : base(user)
        {
            if (loginSuccess && (((user == null) || (user.Identity == null)) || !user.Identity.IsAuthenticated))
            {
                throw new InvalidOperationException(Resources.ApplicationServices_LoginSuccessRequiresAuthN);
            }
            this._loginSuccess = loginSuccess;
        }

        public bool LoginSuccess
        {
            get
            {
                return this._loginSuccess;
            }
        }
    }
}

